package yu.zhou.njupt.fileprocessor;

import yu.zhou.njupt.fileprocessor.bean.CaseSensitive;
import yu.zhou.njupt.fileprocessor.bean.MatchMode;

/**
 * @author yu.zhou
 *
 */
public class FileProcessor {

    protected int numOfProcessFiles; // 执行一次work方法处理的文件数目
    protected int numOFThread; // 处理文件的线程数
	
    protected static Boolean match(String orginStr, String matchStr, MatchMode mode, CaseSensitive caseSensitive) {
        if (caseSensitive == CaseSensitive.FALSE) {
            orginStr = orginStr.toUpperCase();
            matchStr = matchStr.toUpperCase();
        }
        
        if (mode == MatchMode.START_WITH) {
            return orginStr.startsWith(matchStr);
        } else if (mode == MatchMode.END_WITH) {
            return orginStr.endsWith(matchStr);
        } else if (mode == MatchMode.LIKE) {
            return orginStr.contains(matchStr);
        } else {
            return orginStr.equals(matchStr);
        }
    }
}
